IndenterT

Auto-indentation interface.

By default, [class@View] can auto-indent as you type when [property@View:auto-indent] is enabled. The indentation simply copies the previous lines indentation.

This can be changed by implementing GtkSourceIndenter and setting the [property@View:indenter] property.

Implementors of this interface should implement both [vfunc@Indenter.is_trigger] and [vfunc@Indenter.indent].

[vfunc@Indenter.is_trigger] is called upon key-press to determine of the key press should trigger an indentation. The default implementation of the interface checks to see if the key was [const@Gdk.KEY_Return] or [const@Gdk.KEY_KP_Enter] without %GDK_SHIFT_MASK set.

[vfunc@Indenter.indent] is called after text has been inserted into [class@Buffer] when [vfunc@Indenter.is_trigger] returned %TRUE. The [struct@Gtk.TextIter] is placed directly after the inserted character or characters.

It may be beneficial to move the insertion mark using [method@Gtk.TextBuffer.select_range] depending on how the indenter changes the indentation.

All changes are encapsulated within a single user action so that the user may undo them using standard undo/redo accelerators.

Members

Functions

getIndenterStruct
GtkSourceIndenter* getIndenterStruct(bool transferOwnership)

Get the main Gtk struct

indent
void indent(View view, TextIter iter)

This function should be implemented to alter the indentation of text within the view.

isTrigger
bool isTrigger(View view, TextIter location, GdkModifierType state, uint keyval)

This function is used to determine if a key pressed should cause the indenter to automatically indent.

Meta